package com.jz.community.commview.view;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.MotionEvent;

import com.qingmei2.library.SlideBottomLayout;

public class MSlideBottomLayout extends SlideBottomLayout {

    public MSlideBottomLayout(@NonNull Context context) {
        super(context);
    }

    public MSlideBottomLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public MSlideBottomLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    private SlideListener slideListener;

    public void setSlideListener(SlideListener slideListener) {
        this.slideListener = slideListener;
    }

    public interface SlideListener {
        void onSlide(boolean isTop);
    }


    @Override
    public boolean switchVisible() {
        if (slideListener != null) {
            slideListener.onSlide(arriveTop());
        }
        return super.switchVisible();
    }
}
